package binary;
/**补码的演示*/
public class ComplementDemo {
    public static void main(String[] args) {
        //32位2进制数的-1的编码:32个1
        //负值 = (-1)-0位置的权值

        int m = -45;
        System.out.println(Integer.toBinaryString(m));
        System.out.println(Integer.toHexString(m));

/*        //规律数
        int max = Integer.MAX_VALUE;
        int min = Integer.MIN_VALUE;
        System.out.println(Integer.toBinaryString(max));
        System.out.println(Integer.toBinaryString(min));
        System.out.println(Integer.toBinaryString(-1));*/
    }
}
